package router

import (
	"crawler/middleware"
	"crawler/router/group"
	"fmt"

	"go.uber.org/zap"

	"github.com/gin-gonic/gin"
)

func Router() {
	g := gin.Default()
	//跨域
	g.Use(middleware.Cors())

	//路由组声明
	testGroup := group.TestRouter{}

	//路由组
	routerGroup := g.Group("app")
	routerGroup.Use()
	{
		testGroup.TestRouterGroup(routerGroup)
	}

	err := g.Run(":8080")
	if err != nil {
		zap.L().Error(fmt.Sprintf("gin start is failed : %v\n", err))
		return
	}
}
